package routers

import "github.com/gin-gonic/gin"

func LoadCookie(engine *gin.Engine) {
	engine.GET("/read_cookie", func(ctx *gin.Context) {
		val, _ := ctx.Cookie("name")
		ctx.String(200, "Cookie:%s", val)
	})
	engine.GET("/write_cookie", func(ctx *gin.Context) {
		ctx.SetCookie("name", "yzp", 24*60*60, "/", "localhost", false, true)
	})
	engine.GET("/clear_cookie", func(ctx *gin.Context) {
		ctx.SetCookie("name", "yzp", -1, "/", "localhost", false, true)
	})
}
